home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 2
/
Nebula Two.iso
/
SourceCode
/
MiscKit1.7.1
/
MiscKit
/
Palettes
/
MiscSwapKitPalette
/
MiscSVInspector.m
< prev
next >
Wrap
Text File
|
1995-04-12
|
3KB
|
127 lines
// Copyright (C) 1995
// Use is governed by the MiscKit license
#import "MiscSwapKit.subproj/MiscSwapView.h"
#import "MiscSVInspector.h"
@implementation MiscSVInspector
// Load the Inspector
- init
{
char buf[MAXPATHLEN + 1];
id bundle;
[super init];
bundle = [NXBundle bundleForClass:[MiscSwapView class]];
if ([bundle getPath: buf forResource: "MiscSVInspector" ofType:"nib"])
[NXApp loadNibFile:buf owner:self withNames:NO fromZone:[self zone]];
bundle = [NXBundle bundleForClass: [self class] ];
// Load up the images for the backGround gray matrix of buttons.
if ([bundle getPath: buf forResource: "boxBlack" ofType: "tiff"])
[ [bGrayMatrix cellAt: 0 : 3] setImage:
[ [NXImage alloc] initFromFile: buf] ];
if ([bundle getPath: buf forResource: "boxDkgray" ofType: "tiff"])
[ [bGrayMatrix cellAt: 0 : 2] setImage:
[ [NXImage alloc ] initFromFile: buf] ];
if ([bundle getPath: buf forResource: "boxLtgray" ofType: "tiff"])
[ [bGrayMatrix cellAt: 0 : 1] setImage:
[ [NXImage alloc] initFromFile: buf] ];
if ([bundle getPath: buf forResource: "boxWhite" ofType: "tiff"])
[ [bGrayMatrix cellAt: 0 : 0] setImage:
[ [NXImage alloc] initFromFile: buf] ];
[bGrayMatrix display];
return self;
}
// Query the object for it's attributes
- revert: sender
{
int tag = 0;
float gray = 0.0;
[ [optionMatrix cellAt: 0 : 0] setState: [object doesTagComparison] ];
[ [optionMatrix cellAt: 1 : 0] setState: [object doesUseBuffering] ];
[optionMatrix display];
gray = [object backgroundGray];
// Anyone have a better way to do this? I tried just comparing gray
// to NX_BLACK, etc and it did not work.
if (gray >= 0.75) tag = 0;
if (gray < 0.75 && gray >= 0.51) tag = 1;
if (gray < 0.51 && gray >= 0.25) tag = 2;
if (gray < 0.25) tag = 3;
[ [bGrayMatrix selectCellWithTag: tag] display];
return [super revert: sender];
}
- grayChanged:sender
{
float gray = NX_LTGRAY;
switch ([ [bGrayMatrix selectedCell] tag])
{
case 0: gray = NX_WHITE; break;
case 1: gray = NX_LTGRAY; break;
case 2: gray = NX_DKGRAY; break;
case 3: gray = NX_BLACK; break;
}
[object setBackgroundGray: gray];
[object display];
return [super ok: sender];
}
- optionChanged:sender
{
switch ([ [optionMatrix selectedCell] tag])
{
case 0:
[object setTagComparison: [ [optionMatrix cellAt: 0 :0] state] ];
break;
case 1:
[object setUseBuffering: [ [optionMatrix cellAt: 1 : 0] state ] ];
break;
}
return [super ok: sender];
}
- (BOOL)wantsButtons
{
return NO;
}
@end
@implementation MiscSwapView (IBInspector)
- (const char *)getInspectorClassName
{
return "MiscSVInspector";
}
@end